package com.dks.controller;

import com.dks.dto.TestDto;
import com.dks.exception.BaseException;
import com.dks.repository.OrderRepository;
import com.dks.result.ResultInfo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    private OrderRepository orderRepository;

    @GetMapping("test")
    public String test(){
        return orderRepository.test();
    }

    @PostMapping("test/post")
    public String testPost(@RequestBody TestDto testDto){
        return orderRepository.testPost(testDto);
    }

    @GetMapping("test/exception")
    public String testException() throws BaseException {
        throw new BaseException(ResultInfo.EXCEPTION);
    }

}
